/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;

import model.xml.ParseXML;
import entities.vo.ArticuloVO;
import entities.vo.OFADVO;

/**
 *
 * @author Jhonny
 */
public class ModelRecibirOFAD extends Model{

	
    public ModelRecibirOFAD(ModelMain model) {
        
    }

    public OFADVO getOFAD(String path) throws FileNotFoundException, IOException {
        ParseXML parse = new ParseXML();
        return parse.getOFAD(path);
    }
	public List<ArticuloVO> getArticulosNuevos(List<ArticuloVO> articulos) {
		List<ArticuloVO> list = null;
		list = fachada.getNuevoArticulo(articulos);
		return list;
	}

	public List<ArticuloVO> getArticulosExistentes(List<ArticuloVO> newArticulos, List<ArticuloVO> articulos) {
		
		List<ArticuloVO> articuloExistente = new LinkedList<ArticuloVO>();
		if(newArticulos!=null){
			for (ArticuloVO articuloVO : articulos) {
				if(!newArticulos.contains(articuloVO)){
					articuloExistente.add(articuloVO);
				}
			}
		}
		return articuloExistente;
	}

	public String recibirOFAD(OFADVO ofad) {
		return fachada.procesarNuevaOFAD(ofad);		
	}


}
